home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Actual 85 Febrero 2004.iso / Experto / Apache / apache_2.0.48-win32-x86-no_ssl.msi / Data.Cab / F251798_ap_regkey.h < prev    next >
Encoding:
C/C++ Source or Header  |  2003-02-03  |  11.1 KB  |  261 lines

  1. /* ====================================================================
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Apache" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation.  For more
  51.  * information on the Apache Software Foundation, please see
  52.  * <http://www.apache.org/>.
  53.  *
  54.  * Portions of this software are based upon public domain software
  55.  * originally written at the National Center for Supercomputing Applications,
  56.  * University of Illinois, Urbana-Champaign.
  57.  */
  58.  
  59. #ifndef AP_REGKEY_H
  60. #define AP_REGKEY_H
  61.  
  62. #if defined(WIN32) || defined(DOXYGEN)
  63.  
  64. #include "apr.h"
  65. #include "apr_pools.h"
  66. #include "ap_config.h"      /* Just for AP_DECLARE */
  67.  
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71.  
  72. typedef struct ap_regkey_t ap_regkey_t;
  73.  
  74. /* Used to recover AP_REGKEY_* constants 
  75.  */
  76. AP_DECLARE(const ap_regkey_t *) ap_regkey_const(int i);
  77.  
  78. /**
  79.  * @file ap_regkey.h
  80.  * @brief APR-style Win32 Registry Manipulation
  81.  */
  82.  
  83. /**
  84.  * Win32 Only: Constants for ap_regkey_open()
  85.  */
  86. #define AP_REGKEY_CLASSES_ROOT         ap_regkey_const(0)
  87. #define AP_REGKEY_CURRENT_CONFIG       ap_regkey_const(1)
  88. #define AP_REGKEY_CURRENT_USER         ap_regkey_const(2)
  89. #define AP_REGKEY_LOCAL_MACHINE        ap_regkey_const(3)
  90. #define AP_REGKEY_USERS                ap_regkey_const(4)
  91. #define AP_REGKEY_PERFORMANCE_DATA     ap_regkey_const(5)
  92. #define AP_REGKEY_DYN_DATA             ap_regkey_const(6)
  93.  
  94. /**
  95.  * Win32 Only: Flags for ap_regkey_value_set()
  96.  */
  97. #define AP_REGKEY_EXPAND               0x0001
  98.  
  99. /**
  100.  * Win32 Only: Open the specified registry key.
  101.  * @param newkey The opened registry key
  102.  * @param parentkey The open registry key of the parent, or one of
  103.  * <PRE>
  104.  *           AP_REGKEY_CLASSES_ROOT
  105.  *           AP_REGKEY_CURRENT_CONFIG
  106.  *           AP_REGKEY_CURRENT_USER
  107.  *           AP_REGKEY_LOCAL_MACHINE
  108.  *           AP_REGKEY_USERS
  109.  *           AP_REGKEY_PERFORMANCE_DATA 
  110.  *           AP_REGKEY_DYN_DATA 
  111.  * </PRE>
  112.  * @param keyname The path of the key relative to the parent key
  113.  * @param flags Or'ed value of:
  114.  * <PRE>
  115.  *           APR_READ             open key for reading
  116.  *           APR_WRITE            open key for writing
  117.  *           APR_CREATE           create the key if it doesn't exist
  118.  *           APR_EXCL             return error if APR_CREATE and key exists
  119.  * </PRE>
  120.  * @param pool The pool in which newkey is allocated
  121.  */
  122. AP_DECLARE(apr_status_t) ap_regkey_open(ap_regkey_t **newkey, 
  123.                                         const ap_regkey_t *parentkey,
  124.                                         const char *keyname,
  125.                                         apr_int32_t flags, 
  126.                                         apr_pool_t *pool);
  127.  
  128. /**
  129.  * Win32 Only: Close the registry key opened or created by ap_regkey_open().
  130.  * @param key The registry key to close
  131.  */
  132. AP_DECLARE(apr_status_t) ap_regkey_close(ap_regkey_t *key);
  133.  
  134. /**
  135.  * Win32 Only: Remove the given registry key.
  136.  * @param parentkey The open registry key of the parent, or one of
  137.  * <PRE>
  138.  *           AP_REGKEY_CLASSES_ROOT
  139.  *           AP_REGKEY_CURRENT_CONFIG
  140.  *           AP_REGKEY_CURRENT_USER
  141.  *           AP_REGKEY_LOCAL_MACHINE
  142.  *           AP_REGKEY_USERS
  143.  *           AP_REGKEY_PERFORMANCE_DATA 
  144.  *           AP_REGKEY_DYN_DATA 
  145.  * </PRE>
  146.  * @param keyname The path of the key relative to the parent key
  147.  * @param pool The pool used for temp allocations
  148.  * @remark ap_regkey_remove() is not recursive, although it removes
  149.  * all values within the given keyname, it will not remove a key 
  150.  * containing subkeys.
  151.  */
  152. AP_DECLARE(apr_status_t) ap_regkey_remove(const ap_regkey_t *parent, 
  153.                                           const char *keyname,
  154.                                           apr_pool_t *pool);
  155.  
  156. /**
  157.  * Win32 Only: Retrieve a registry value string from an open key.
  158.  * @param result The string value retrieved 
  159.  * @param key The registry key to retrieve the value from
  160.  * @param valuename The named value to retrieve (pass "" for the default)
  161.  * @param pool The pool used to store the result
  162.  * @remark There is no toggle to prevent environment variable expansion
  163.  * if the registry value is set with AP_REG_EXPAND (REG_EXPAND_SZ), such
  164.  * expansions are always performed.
  165.  */
  166. AP_DECLARE(apr_status_t) ap_regkey_value_get(char **result, 
  167.                                              ap_regkey_t *key, 
  168.                                              const char *valuename, 
  169.                                              apr_pool_t *pool);
  170.  
  171. /**
  172.  * Win32 Only: Store a registry value string into an open key.
  173.  * @param key The registry key to store the value into
  174.  * @param valuename The named value to store (pass "" for the default)
  175.  * @param value The string to store for the named value
  176.  * @param flags The option AP_REGKEY_EXPAND or 0, where AP_REGKEY_EXPAND
  177.  * values will find all %foo% variables expanded from the environment.
  178.  * @param pool The pool used for temp allocations
  179.  */
  180. AP_DECLARE(apr_status_t) ap_regkey_value_set(ap_regkey_t *key, 
  181.                                              const char *valuename, 
  182.                                              const char *value, 
  183.                                              apr_int32_t flags,
  184.                                              apr_pool_t *pool);
  185.  
  186. /**
  187.  * Win32 Only: Retrieve a raw byte value from an open key.
  188.  * @param result The raw bytes value retrieved 
  189.  * @param resultsize Pointer to a variable to store the number raw bytes retrieved 
  190.  * @param key The registry key to retrieve the value from
  191.  * @param valuename The named value to retrieve (pass "" for the default)
  192.  * @param pool The pool used to store the result
  193.  */
  194. AP_DECLARE(apr_status_t) ap_regkey_value_raw_get(void **result, 
  195.                                                  apr_size_t *resultsize,
  196.                                                  apr_int32_t *resulttype,
  197.                                                  ap_regkey_t *key, 
  198.                                                  const char *valuename, 
  199.                                                  apr_pool_t *pool);
  200.  
  201. /**
  202.  * Win32 Only: Store a raw bytes value into an open key.
  203.  * @param key The registry key to store the value into
  204.  * @param valuename The named value to store (pass "" for the default)
  205.  * @param value The bytes to store for the named value
  206.  * @param valuesize The number of bytes for value
  207.  * @param valuetype The 
  208.  * values will find all %foo% variables expanded from the environment.
  209.  * @param pool The pool used for temp allocations
  210.  */
  211. AP_DECLARE(apr_status_t) ap_regkey_value_raw_set(ap_regkey_t *key, 
  212.                                                  const char *valuename, 
  213.                                                  const void *value, 
  214.                                                  apr_size_t  valuesize,
  215.                                                  apr_int32_t valuetype,
  216.                                                  apr_pool_t *pool);
  217.  
  218. /**
  219.  * Win32 Only: Retrieve a registry value string from an open key.
  220.  * @param result The string elements retrieved from a REG_MULTI_SZ string array
  221.  * @param key The registry key to retrieve the value from
  222.  * @param valuename The named value to retrieve (pass "" for the default)
  223.  * @param pool The pool used to store the result
  224.  */
  225. AP_DECLARE(apr_status_t) ap_regkey_value_array_get(apr_array_header_t **result, 
  226.                                                    ap_regkey_t *key,
  227.                                                    const char *valuename, 
  228.                                                    apr_pool_t *pool);
  229.  
  230. /**
  231.  * Win32 Only: Store a registry value string array into an open key.
  232.  * @param key The registry key to store the value into
  233.  * @param valuename The named value to store (pass "" for the default)
  234.  * @param nelts The string elements to store in a REG_MULTI_SZ string array
  235.  * @param elts The number of elements in the elts string array
  236.  * @param pool The pool used for temp allocations
  237.  */
  238. AP_DECLARE(apr_status_t) ap_regkey_value_array_set(ap_regkey_t *key, 
  239.                                                    const char *valuename, 
  240.                                                    int nelts, 
  241.                                                    const char * const * elts,
  242.                                                    apr_pool_t *pool);
  243.  
  244. /**
  245.  * Win32 Only: Remove a registry value from an open key.
  246.  * @param key The registry key to remove the value from
  247.  * @param valuename The named value to remove (pass "" for the default)
  248.  * @param pool The pool used for temp allocations
  249.  */
  250. AP_DECLARE(apr_status_t) ap_regkey_value_remove(const ap_regkey_t *key, 
  251.                                                 const char *valuename,
  252.                                                 apr_pool_t *pool);
  253.  
  254. #ifdef __cplusplus
  255. }
  256. #endif
  257.  
  258. #endif /* def WIN32 || def DOXYGEN */
  259.  
  260. #endif /* AP_REGKEY_H */
  261.